home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / pclist.bas < prev    next >
BASIC Source File  |  1985-06-03  |  3KB  |  65 lines

  1. 1 ' PCLIST 12/16/82   V1.1
  2. 2 '
  3. 3 'COPYRIGHT (c) 1982 by Buzz Hamilton
  4. 4 '                      29 Crawford Street
  5. 5 '                      Northboro, MA 01532 (617) 393-3199
  6. 6 '
  7. 7 'Permission to copy this program is granted except for commercial gain.
  8. 8 '
  9. 9 '
  10. 10 'This program will send a formatted listing of a PCBASIC program to the
  11. 11 'printer.  Multiple file names will be accepted separated by commas.  All
  12. 12 'input files must be ASCII-saved files.  The default  extension is .LST.
  13. 13 'The listing will have each statement on a separate line with THEN/ELSE
  14. 14 'statements aligned.  Condensed printing can be obtained by using the /W
  15. 15 'switch at the end of the file query response.
  16. 16 '
  17. 17 'This program has the printer codes for the IBM 80 cps (EPSON) printer.
  18. 18 'Users of other printers should put the proper control codes in line 110.
  19. 19 '
  20. 20 'Some printers do not turn off double width at the end of a line.  To cover
  21. 21 'these cases, I have added a variable SW$ for single width in line 110
  22. 22 'and used it in line 380.  I also added the time in lines 125 and 380.
  23. 23 '9/1/84
  24. 24 '
  25. 100 DEFINT A-Z
  26. 110 COFF$=CHR$(29):CON$=CHR$(31):DW$=CHR$(1):SW$=CHR$(20):FF$=CHR$(12):'COMPRESS OFF/ON, DOUBLE WIDTH, SINGLE WIDTH, TOP OF FORM FOR IBM (EPSON) PRINTER
  27. 120 ON ERROR GOTO 390:Q$=CHR$(34):C$=CHR$(58):L$=CHR$(10):CLS:PRINT TAB(10);"BASIC FORMAT AND LIST PROGRAM":PRINT:PRINT TAB(10);"LIST 1-24 for instructions":PRINT:PRINT TAB(10);"Files must be saved in ASCII":PRINT:LPRINT COFF$;
  28. 125 DATE.F$=DATE$:TIME.F$=LEFT$(TIME$,5) 'fix date and time
  29. 130 LINE INPUT "File name(s):";FS$:IF RIGHT$(FS$,2)="/W" THEN FS$=LEFT$(FS$,LEN(FS$)-2):WIDTH "LPT1:",132:LPRINT CON$;:IF PE THEN PRINT"THANKS!":PE=0
  30. 140 IF LEN(FS$)=0 THEN GOTO 480
  31. 150 FD=INSTR(FS$,","):IF FD=0 THEN FD=LEN(FS$)+1
  32. 160 F$=LEFT$(FS$,FD-1):IF INSTR(F$,".")=0 THEN F$=F$+".LST":GOTO 170
  33. 170 OPEN "I",1,F$:GOSUB 380:IF PE THEN PRINT"THANKS!":PE=0
  34. 180 LINE INPUT #1,LIN$:LN=LEN(LIN$):T=7:P=INSTR(LIN$," ")+1:PLN=1:X=P:R=999
  35. 190 X$="'":GOSUB 320:R=NT:X$="REM ":GOSUB 320:IF R=0 AND NT=0 THEN R=999
  36. 200 IF NT AND NT<R THEN R=NT
  37. 210 LT=INSTR(X,LIN$,Q$):ST=INSTR(X,LIN$,C$)
  38. 220 IF ST=0 OR ST>R THEN P2=LN:GOTO 250
  39. 230 IF LT=0 OR ST<LT THEN P2=ST:GOTO 250
  40. 240 LT2=INSTR(LT+1,LIN$,Q$):IF LT2 THEN X=LT2+1:GOTO 210 ELSE P2=LN
  41. 250 L=L+1:IF L>55 THEN LPRINT FF$;:GOSUB 380
  42. 260 IF PLN THEN LPRINT USING "#####";VAL(LEFT$(LIN$,P-2));:PLN=0
  43. 270 IF NE THEN LPRINT TAB(T-6);" ELSE ";:NE=0
  44. 280 X$=" ELSE ":GOSUB 320:IF NT THEN P2=NT-1:NE=NT
  45. 290 LPRINT TAB(T):S=0:WHILE ASC(MID$(LIN$,P+S))=32:S=S+1:WEND:P=P+S:LPRINT MID$(LIN$,P,P2-P+1):X$=" THEN ":GOSUB 320:IF NT THEN T=T+NT-P+6
  46. 300 IF NE THEN P2=P2+6
  47. 310 IF P2<LN THEN P=P2+1:X=P:GOTO 190 ELSE 180
  48. 320 Z9=P
  49. 330 NT=INSTR(Z9,LIN$,X$):IF NT=0 OR NT>P2 OR R<NT THEN NT=0:GOTO 370
  50. 340 Q1=INSTR(Z9,LIN$,Q$):IF Q1=0 OR Q1>NT THEN 370
  51. 350 Q2=INSTR(Q1+1,LIN$,Q$):IF Q2=0 THEN Q2=LN
  52. 360 IF Q2>NT THEN Z9=Q2+1:GOTO 330
  53. 370 RETURN
  54. 380 LPRINT DW$;F$;"    ";TIME.F$;"   ";DATE.F$;SW$+L$;L$:L=0:RETURN
  55. 390 IF ERR=62 THEN RESUME 460
  56. 400 IF ERR<>24 AND ERR<>27 THEN 430
  57. 410 IF PE=0 THEN PE=1:PRINT"TURN ON THE PRINTER!"
  58. 420 RESUME
  59. 430 IF ERR<>53 THEN 450
  60. 440 PRINT F$;"- NOT FOUND":IF FD=LEN(FS$)+1 THEN RESUME 130 ELSE RESUME 470
  61. 450 ON ERROR GOTO 0
  62. 460 LPRINT FF$;:IF FD=LEN(FS$)+1 THEN LPRINT FF$;COF$;:GOTO 480
  63. 470 CLOSE 1:FS$=MID$(FS$,FD+1):GOTO 150
  64. 480 ON ERROR GOTO 0:END
  65.